home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
swagg_m.zip
/
GRAPHICS.SWG
/
0107_Fast Line Drawing.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-08-24
|
993b
|
45 lines
{
SS> I'm looking for a qwick way to draw a line... All I need are
SS> horizontal and vertical lines, so would it be easiest to use a
SS> series of PutPixels?
Unfortunately you don't specify which mode you're working in, so
I assume it is 320x200 (which tends to be the most popular mode here):
}
Procedure DHL(x, y, Length : Word; Color : Byte); Assembler;
Asm
mov ax,0a000h
mov es,ax
mov ax,y
shl ax,6
mov di,ax
shl ax,2
add di,ax
add di,x
mov cx,Length
mov al,Color
cld
rep stosb { I bet I'll get loads of replies which uses stosw instead :) }
End;
Procedure DVL(x, y, Length : Word; Color : Byte); Assembler;
Asm
mov ax,0a000h
mov es,ax
mov ax,y
shl ax,6
mov di,ax
shl ax,2
add di,ax
add di,x
mov al,Color
mov cx,Length
@DVL1:
mov es:[di],al
add di,320
dec cx
jnz @DVL1
End;